//    Copyright (C) Kherty.  All rights reserved.


using System.Windows;
using OpenLS.Chart.UI.Internals;

namespace OpenLS.Chart.UI
{
    partial class LegendResources
    {
        public LegendResources()
        {
            InitializeComponent();
        }

        private void OnDeleteLegend(object sender, System.Windows.Input.ExecutedRoutedEventArgs e)
        {
            ChartArea chartArea = ChartElement.GetChartArea((DependencyObject) sender);
            chartArea.Legend = null;
            e.Handled = true;
        }

        private void ItemsControl_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            ((IInputElement) sender).Focus();
            e.Handled = true;
        }

        private void OnFormatLegend(object sender, System.Windows.Input.ExecutedRoutedEventArgs e)
        {
            FrameworkElement source = (FrameworkElement)e.Source;
            Legend l = ChartElement.GetLegend(source);
            PropertyHelper.ShowPropertiesFor(l, source, UIStringTable.FormatLegend, PropertyTabHint.None);
            e.Handled = true;
        }

        private void OnFormat3DRotation(object sender, System.Windows.Input.ExecutedRoutedEventArgs e)
        {
            FrameworkElement source = (FrameworkElement)e.Source;
            ChartArea l = ChartElement.GetChartArea(source);
            PropertyHelper.ShowPropertiesFor(l, source, ChartCommands.FormatChartArea.Text, PropertyTabHint.View3D);
            e.Handled = true;
        }
    }
}
